﻿using System;

namespace CrmRulo
{
    public interface IReportManager
    {
        /// <summary>
        /// Searches for a report in CRM. Fails if more than one report with the given name exist.
        /// </summary>
        /// <param name="reportName">The name of the report.</param>
        /// <returns>The id of the report, null if not found.</returns>
        Report FindReport(string reportName);

        /// <summary>
        /// Creates a new report in CRM
        /// </summary>
        /// <param name="r">The report</param>
        /// <returns>The id of the new report</returns>
        Guid CreateReport(Report r);

        /// <summary>
        /// Updates an existing report in CRM
        /// </summary>
        /// <param name="r">The report</param>
        void UpdateReport(Report r);

        /// <summary>
        /// Creates an auxiliary reportentity record for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        /// <param name="entityLogicalName">The entity name to attach the report to</param>
        void AddEntityCode(Guid reportId, string entityLogicalName);

        /// <summary>
        /// Deletes all auxiliary reportentity records for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        void RemoveEntityCodeInformation(Guid reportId);

        /// <summary>
        /// Creates an auxiliary reportcategory record for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        /// <param name="category">The category id  (see ReportCategory enum)</param>
        void AddCategory(Guid reportId, int category);

        /// <summary>
        /// Deletes all auxiliary reportcategory records for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        void RemoveCategoryInformation(Guid reportId);

        /// <summary>
        /// Creates an auxiliary reportvisibility record for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        /// <param name="visibility">The visility value identificator (see ReportVisibilityCode enum)</param>
        void AddVisibility(Guid reportId, int visibility);

        /// <summary>
        /// Deletes all auxiliary reportvisibility records for a report
        /// </summary>
        /// <param name="reportId">The report id</param>
        void RemoveVisibilityInformation(Guid reportId);

    }
}